package org.lanqiao.tjut.dao;

import java.util.List;

import org.apache.commons.dbutils.handlers.BeanListHandler;
import org.lanqiao.tjut.bean.UsersBean;
import org.lanqiao.tjut.bean.UsersBeanA;
import org.lanqiao.tjut.db.DBDriverFactory;



//import org.apache.commons.dbutils.handlers.BeanListHandler;
//包路径为WebContent\WEB-INF\lib   
public class LoginDao {

	/**
	 * 用户登录验证
	 * 
	 * @param usersB
	 *            用户信息实体对象
	 * @return 登录验证结果
	 */
	public List<UsersBeanA> isLogined(UsersBeanA usersBA) {

		// 登录验证sql语句
		String strSql = "SELECT * FROM (SELECT * FROM EDUUSERS UNION ALL (SELECT * FROM EASTEA UNION ALL SELECT * FROM EASSTU)) WHERE USERNUM = ? AND USERPSW = ?";
		List<UsersBeanA> lstUsers = DBDriverFactory.getDBDriverInstance().query(strSql,
				new BeanListHandler<UsersBeanA>(UsersBeanA.class),
				new Object[] { usersBA.getUsernum(), usersBA.getUserpsw() });

		return lstUsers;
	}
}
